package com.itheima.io.bufferedinputstream.demo03;

import java.io.*;

public class CopyFileDemo {

    public static void main(String[] args) throws IOException {

        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("E:\\黑马就业班面授视频\\day11\\Video_2019-09-05_143304.wmv"));
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("E:\\黑马就业班面授视频\\Video_2019-09-05_143304.wmv"));

//        int by = -1;
//        while ((by = bufferedInputStream.read()) != -1){
//            bufferedOutputStream.write(by);
//        }

        byte[] bytes = new byte[1024];
        int len = -1;
        while ((len = bufferedInputStream.read(bytes)) != -1){
            bufferedOutputStream.write(bytes, 0, len);
        }

        bufferedOutputStream.close();
        bufferedInputStream.close();

    }
}
